document.addEventListener('DOMContentLoaded', () => {
    const videoPlayer = document.getElementById('videoPlayer');
    const playPauseBtn = document.getElementById('playPauseBtn');
    const rewindBtn = document.getElementById('rewindBtn');
    const forwardBtn = document.getElementById('forwardBtn');
    const speedSelector = document.getElementById('speedSelector');

    let isPlaying = false;

    // Play/Pause functionality
    playPauseBtn.addEventListener('click', () => {
        if (isPlaying) {
            videoPlayer.pause();
            playPauseBtn.textContent = 'Play';
        } else {
            videoPlayer.play();
            playPauseBtn.textContent = 'Pause';
        }
        isPlaying = !isPlaying;
    });

    // Rewind functionality (rewind by 10 seconds)
    rewindBtn.addEventListener('click', () => {
        videoPlayer.currentTime -= 10;
    });

    // Forward functionality (forward by 10 seconds)
    forwardBtn.addEventListener('click', () => {
        videoPlayer.currentTime += 10;
    });

    // Speed control functionality
    speedSelector.addEventListener('change', (event) => {
        videoPlayer.playbackRate = parseFloat(event.target.value);
    });
});
